/**
 * 
 */

$(function(){
	
	//查询
	$("#btnSearch").click(function(){
		var formSerialize = $("#form").serializeObject();
		var v = JSON.stringify(formSerialize);
		$("#v").val(encodeURIComponent(v));
		form.submit();
	});
	
});

function cancel(id){
	
	$.layer({
	    shade: [0],
	    area: ['auto','auto'],
	    dialog: {
	        msg: '是否确定注销该广告商？',
	        btns: 2,                    
	        type: 4,
	        btn: ['确定','取消'],
	        yes: function(){
	        	security.ajax({
	        		url : global.rootPath + "/adv/cancel",
	        		data : {
	        			id : id
	        		},
	        		beforeSend : function(){
	        			security.showLoading();
	        		},
	        		success : function(code,msg) {
	        			if (msg == "") msg = "注销成功";
	        			security.showSuccess(msg,refresh);
	        		},
	        		error : function(message) {
	        			security.showError(message);
	        		}
	        	});
	        }, no: function(){
	        }
	    }
	});
	
	
}

function refresh() {
	var formSerialize = $("#form").serializeObject();
	var v = JSON.stringify(formSerialize);
	$("#v").val(encodeURIComponent(v));
	form.submit();
}